<?php if(empty($error)) { ?>
<table class="data_tab">
    <thead>
    <tr>
        <th>Дата</th>
        <th>Тема</th>
        <th>Е-mail</th>
        <th>Телефон</th>
        <th>Сообщение</th>
    </tr>
    </thead>
    <tbody>
    <?php foreach($messages as $mess) { ?>
    <tr>
        <td><?=$mess['date_create']?></td>
        <td><?=$mess['subject']?></td>
        <td><?=$mess['email']?></td>
        <td><?=$mess['phone']?></td>
        <td><p class="longtext"><?=$mess['body']?></p></td>
    </tr>
    <?php } ?>
    </tbody>
</table>
<?php } else { ?>
<div class="error"><?=$error?></div>
<?php }?>